<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title><!--{$title}--></title>
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<link rel="stylesheet" href="<!--{$url_prefix}-->css/bootstrap.css" />
<link rel="stylesheet" href="<!--{$url_prefix}-->css/about.css" />
<link rel="stylesheet" href="<!--{$url_prefix}-->css/bootstrap-responsive.css" /><!-- 加入后变为响应式布局，去掉变为固定宽度布局 -->
<link rel="stylesheet" href="<!--{$url_prefix}-->css/index2.css" />
<script src="<!--{$url_prefix}-->js/jquery.js"></script>
<script src="<!--{$url_prefix}-->js/bootstrap.js"></script>
<script src="<!--{$url_prefix}-->js/swipe.js"></script>
<!--[if lt IE 9]>
  <script src="<!--{$url_prefix}-->/js/html5.js"></script>
<![endif]-->

<body>
<div class="main">
<div class="container clearfix" id="slider">
<div id="reclassify" class="<!--{if $template == 1}-->reclassify<!--{elseif $template == 2}-->templet_container01<!--{/if}-->">
<ul class="contain">
    <!--{if $list}-->
    <!--{foreach from=$list item=value}-->
    <!--{if $template == 2}-->
        <li class="clearfix list">
        <a target="_blank" href="<!--{$value.url}-->">
        <p class="extend_pic"><img src="<!--{get_img_url($value.show_url,'content',0,'default.jpg')}-->"/></p>
        <p class="extend_title"><!--{$value.title|truncate:"10":" "}--></p>
        <p class="full_text">查看全文&gt;&gt;</p>
        </a>
        </li>
    <!--{else}-->
        <li class="clearfix list">
        <div class="time">
        <p><span class="timed"><!--{date('d',strtotime($value.created))}--></span>/<span class="timem"><!--{date('m',strtotime($value.created))}--></span></p>
        <p class="timey"><!--{date('Y',strtotime($value.created))}--></p>
        <span class="timex"></span>
        </div>
        <a href="<!--{$value.url}-->">
        <div class="mediaPanel media ">
        <div class="mediaHead"><span class="title"><!--{$value.title|truncate:"10":" "}--></span></div>
        <div class="mediaImg"><img src="<!--{get_img_url($value.show_url,'content',0,'bg_mr.png')}-->" /></div>
        <div class="mediaContent mediaContentP">
        <p></p>
        </div>
        <div class="mediaFooter">
        <span class="mesgIcon">&gt;</span><span class="left" style="line-height:50px;">查看全文</span>
            <div class="clr"></div>
        </div>
        </div>
        </a>
        </li>
    <!--{/if}-->
    <!--{/foreach}-->
    <!--{else}-->
	   <div class="media alphabg" style="margin: 10%  auto ; float: none"><div class="error_pop" style="color: #008800; font-size: 28px; line-height: 100px; text-align: center;">没有数据了</div></div>
	<!--{/if}-->
    <input type="hidden" name="cpage" id="cpage" value="<!--{$cpage}-->" />
    <script type="text/javascript">
        var flag = 0;
    	$(window).bind(
        "scroll",
        function() {
            if ($(document).height() - $(window).height()
                    - $(document).scrollTop() < 10 && flag == 0) {
                flag = 1;
                get_page_data();
            }
        });
    	function get_page_data() {
    		var page = parseInt($("#cpage").val()) + 1;
    		if($('.error_pop').length == 0){
    			$.ajax({
    				url : '<!--{$url}-->/home/class_list?t=<!--{$type}-->&id=<!--{$id}-->&p='+page+'&template=<!--{$template}-->',
    				type : "get",
    				success : function(data) {
    					result = $(data).find(".list");
    					nexpage = $(data).find("#cpage").val();
    					if (nexpage) {
    						$("#cpage").val(nexpage);
    					}
    					if (result.get(0) != undefined) {
    						//if(!result.find('.error_pop')){
    							$(".contain").append(result);
    							flag = 0;
    						//}
    					}
    				}
    			});
    		}
    	}
    </script>
</ul>
</div>
<!--div class="error_pop"></div-->
<div id="content" style="display:none;"><!--{$introduction}--></div>
</div>
<!--<footer>powered by <a href="http://www.it008.com" target="_blank">赏金猎人</a></footer>-->
</div>
<script>
$(document).ready(function(){
	new Swipe(document.getElementById('banner_box'), {
		speed:500,
		auto:3000,
		continuous:false,
		stopPropagation:true,
		disableScroll: true, 
		callback: function(){
			var lis = $(this.element).next("ol").children();
			lis.removeClass("on").eq(this.index).addClass("on"); 
		}
	});
});
var content = $('#content').html();
var html_audio = content.match(/<[embed|embed].*?src=[\'|\"](.*?(?:[\.mp3|\.ogg|\.wav]))[\'|\"].*?[\/]?>/ig);  //content.replace(/<[embed|embed].*?src=[\'|\"](.*?(?:[\.mp3|\.ogg|\.wav]))[\'|\"].*?[\/]?>/ig, ",");
var html = content;
if(html_audio != null){
    if(html_audio.length > 0){
        var img_name = '';
        for(var i=0;i<html_audio.length;i++){
            img_name = html_audio[i].match(/<embed.*src\s*=\s*[\"|\']?\s*([^>\"\'\s]*)/i);
            if(img_name != null){
                if(img_name.length >= 2){
                    html = html.replace(html_audio[i],'<div onclick="bind_play(this,'+i+')" id="audio_div'+i+'" class="audioplay"><img src="/wapi/img/play.png"/><input type="hidden" name="audio_src" value="'+img_name[1]+'" /></div>');
                }
            }else{
                html = content;
            }
        }
    }
}
$('#activity_content').html(html);

function bind_play(obj,num){
    var pli = $(obj);
    var index = $("#activity_content div").index(pli);
    if(pli.attr('class') == 'audioplay playing'){
        pli.removeClass('playing');
        if($('#audio_'+index).get(0)){
            $('#audio_'+index).get(0).pause();
        }
        pli.children('img').attr('src','/wapi/img/play.png');
    }else{
        pli.addClass('playing');
        var a_src = pli.find('input[name=audio_src]').val();
        var point = a_src.lastIndexOf(".");
        var type = a_src.substr(point);
        var a_type = 'mpeg';
        if(type == '.wav'){
            a_type = 'wav';
        }else if(type == '.ogg'){
            a_type = 'ogg';
        }else if(type == '.mp3'){
        }else{
            $('.error_pop').text('您的浏览器不支持播放该歌曲').show();
            return false;
        }
        var playnum = 0;
        for(var a=0;a< $('audio').length;a++){
            if(!$('audio')[a].paused){
                playnum = a;
                $('audio')[a].pause();
                if(a!=num){
                    $('#audio_div'+a).removeClass('playing');
                    $('#audio_div'+a).children('img').attr('src','/wapi/img/play.png');
                }
            }
        }
        var audioHtml = '<audio id="audio_' + index +'" controls="controls" preload="auto"><source src="'+ a_src +'"></source></audio>';

        if(!$('#audio_'+index)[0]){
            $("#audio_div").append(audioHtml);
        }
        $('#audio_'+index).hide();
        pli.children('img').attr('src','/wapi/img/stop.png');
        $('#audio_'+index).get(0).play();
    }
}
</script>
</body>
</html>